<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>添加内容 - Powered By Betou</title>
<meta name="author" content="Betou Team" />
<meta name="copyright" content="Betou" />
<#include "../head.html"/>
<script type="text/javascript" src="${base}/thirdparty/editor/xheditor-1.2.1.min.js"></script>
<script type="text/javascript" src="${base}/thirdparty/editor/xheditor_lang/zh-cn.js"></script>
<script type="text/javascript" src="${base}/thirdparty/editor/editor.js"></script>

<script type="text/javascript">
$().ready(function() {

	var $inputForm = $("#inputForm");
	
	// 表单验证
	$inputForm.validate({
		rules: {
			title:"required",
			description:{
				maxlength:70
			},
			channelId:"required",
			content:{
				required:true,
				minlength:5
			}
		},
	});

	initEditor();
	
	showSmsGroup($('#channelId').val());

	$('#channelId').change(function(){
		showSmsGroup($(this).val());
	})
});

showSmsGroup = function(id){
	$.ajax({
		url: "../v_channel_sms.jspx" ,
		type: "POST",
		data:{"id": id},
		cache: false,
		success: function(message) {
			$('#smsGroups').html( message );
			loadSmsNumAndUseNum("send", "smsGroup");
			$("#inputForm input[name*=smsGroup]").click(function(){
				loadSmsNumAndUseNum("send", "smsGroup");
			})
		},
		error:function(xmlHttpRequest, message, e){
			$.message( "error", e );
		}
	});
}
</script>
</head>
<body class="content">
	<div class="path">
		<a href="../index.jspx">首页</a> &raquo; 添加内容
	</div>
	<form id="inputForm" action="o_save.jspx" method="post"  >
		<table class="input tabContent">
			<tr>
				<th><span class="requiredField">*</span>栏目:</th>
				<td>
					<select name="channelId" id="channelId">
					<#if channelList?size gt 0><#assign origDeep=channelList[0]["deep"]+1/></#if>
					<#list channelList as item>
						<option value="${item.id}" >
						<#if item["deep"] gte origDeep><#list origDeep..item["deep"] as i>&nbsp;&nbsp;</#list>></#if>
						${item.name}
						</option>
					</#list>
					</select>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>标题:</th>
				<td>
					<input type="text" name="title" class="text" maxlength="150" style="width:350px"/>
				</td>
			</tr>
			<tr>
				<th>短信发送:</th>
				<td id="smsGroups">
					正在加载...
				</td>
			</tr>
			<tr>
				<th>设置:</th>
				<td>
					<label>
						<input type="checkbox" value="true" name="recommend"/>是否推荐
					</label>
					<label>
						<input type="checkbox" value="true" name="send" title="勾选之后，根据当前栏目的属性决定是否发送短信"/>发送短信
						<span id="loading" class="green">正在加载短信信息...</span>
					</label>
				</td>
			</tr>
			<tr>
				<th>摘要:</th>
				<td>
					<textarea class="text" name="description" style="height:80px" title="不可超过70个字符"></textarea>
				</td>
			</tr>
			<tr>
				<th>内容:</th>
				<td>
					<textarea class="text"  name="content"  id="at_tab_text"></textarea>
				</td>
			</tr>
		</table>
		
		<table class="input">
			<tr>
				<th>
					&nbsp;
				</th>
				<td>
					<input type="submit" class="button" value="确&nbsp;&nbsp;定" />
					<input type="button" class="button" value="返&nbsp;&nbsp;回" onclick="location.href='v_list.jspx'" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
